package model;

import javax.swing.DefaultListModel;

/**
 * This is the model: the list of the connected remote users
 * This list is connected to the view: UserListWindow which is update when 
 * a remote user is added or removed
 */
public class UserList {
	
	private DefaultListModel userList;
	
	/**
	 * @param userList is the list of connected users created in the controller
	 */
	public UserList(DefaultListModel userList) {
		this.userList = userList;
	}
	
	/**
	 * adds a user to the list
	 * @param user is the remote user to add
	 */
	public void addUser(RemoteUser user) {
		this.userList.addElement(user);
	}
	
	/**
	 * removes a user to the list
	 * @param user is the remote user to remove
	 */
	public void delUser (RemoteUser user) {
		this.userList.removeElement(user);
	}
	
	/**
	 * @return the list of connected users
	 */
	public DefaultListModel getUserList() {
		return this.userList;
	}
}
